c9f18b
@@ -54,7 +54,10 @@
public class InfinispanRouteLocator implements RouteLocator {
         DistributionManager dist = this.cache.getAdvancedCache().getDistributionManager();
         Address address = (dist != null) && !this.cache.getCacheConfiguration().clustering().cacheMode().isScattered() ? dist.getCacheTopology().getDistribution(new Key<>(sessionId)).primary() : this.cache.getCacheManager().getAddress();
         Node node = (address != null) ? this.factory.createNode(address) : null;
-        Map.Entry<String, Void> entry = this.registry.getEntry((node != null) ? node : this.registry.getGroup().getLocalMember());
+        Map.Entry<String, Void> entry = (node != null) ? this.registry.getEntry(node) : null;
+        if (entry == null) {
+            entry = this.registry.getEntry(this.registry.getGroup().getLocalMember());
+        }
         return (entry != null) ? entry.getKey() : null;
     }
 }
